Conversation
📝 WalkthroughWalkthroughAdded a new non-default static library target Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
xmake.lua (1)
242-271: The option→dep wiring is repetitive and may drift over time.This block duplicates a large conditional matrix. A tiny helper for optional public deps/packages would make updates safer and shorter.
Refactor sketch
+local function add_public_dep_if(opt, dep, pkgs) + if has_config(opt) then + add_deps(dep, { public = true }) + if pkgs then + add_packages(table.unpack(pkgs), { public = true }) + end + end +end ... - if has_config("option") then - add_deps("option", { public = true }) - end + add_public_dep_if("option", "option")🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@xmake.lua` around lines 242 - 271, Replace the repetitive conditional wiring by extracting a small helper that checks has_config and adds public deps/packages in one place; implement a function (e.g., add_optional = function(cfg, dep_names, pkg_names) ...) that calls has_config(cfg) and then add_deps(..., { public = true }) and add_packages(..., { public = true }) as needed, then use it for "serde" and its sub-features ("serde_simdjson" -> add "serde_json" + "simdjson","yyjson"; "serde_flatbuffers" -> "serde_flatbuffers" + "flatbuffers"; "serde_toml" -> "serde_toml" + "toml++"), and for "option", "deco" (guard deco on has_config("option") too), "ztest" (add "ztest" + package "cpptrace") and "async" (add "async" + package "libuv") to remove duplicated has_config/add_deps/add_packages calls while preserving public=true semantics.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@xmake.lua`:
- Around line 233-236: The current guard around has_config("test") prevents
add_rules("utils.merge.archive") and set_policy("build.merge_archive", true)
from being applied by default (since test defaults to true); to restore
single-staticlib behavior by default, remove the conditional and invoke
add_rules("utils.merge.archive") and set_policy("build.merge_archive", true)
unconditionally (or move those two calls outside the if not has_config("test")
block) so the merge-archive rule and policy are always set unless explicitly
overridden.
---
Nitpick comments:
In `@xmake.lua`:
- Around line 242-271: Replace the repetitive conditional wiring by extracting a
small helper that checks has_config and adds public deps/packages in one place;
implement a function (e.g., add_optional = function(cfg, dep_names, pkg_names)
...) that calls has_config(cfg) and then add_deps(..., { public = true }) and
add_packages(..., { public = true }) as needed, then use it for "serde" and its
sub-features ("serde_simdjson" -> add "serde_json" + "simdjson","yyjson";
"serde_flatbuffers" -> "serde_flatbuffers" + "flatbuffers"; "serde_toml" ->
"serde_toml" + "toml++"), and for "option", "deco" (guard deco on
has_config("option") too), "ztest" (add "ztest" + package "cpptrace") and
"async" (add "async" + package "libuv") to remove duplicated
has_config/add_deps/add_packages calls while preserving public=true semantics.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
Summary by CodeRabbit